<#include "/common/taglibs.ftl" />
<#include "/personal/message/taglibs/messageView.ftl" />
<#include "/personal/message/taglibs/messageFromToDesc.ftl" />
<@menu code='personal.message'/>
<#assign op = 'op.view'/>
<title><@spring.message code="${entityName!}" /> - <@spring.message code="${op}" /></title>
<div class="tabbable-custom ">
    <ul class="nav nav-tabs">
        <li class="active">
            <a href="${ctx}/personal/message/${m.id}?BackURL=<@BackURL/>">
                <i class="fa fa-table"></i>
                <@spring.message code="${op}" /><@spring.message code="${entityName!}" />
            </a>
        </li>
        <li>
            <a href="<@BackURL/>" class="btn btn-link">
                <i class="fa fa-reply"></i>
                <@spring.message code="button.back" />
            </a>
        </li>
    </ul>

    <@showMessage/>
    
    <div class="portlet light bordered">
        <div class="portlet-title">
            <div class="caption">
                <i class="icon-user font-blue-hoki"></i>
                <span class="caption-subject font-blue-hoki bold uppercase"><@spring.message code="${op}" /><@spring.message code="${entityName!}"/></span>
            </div>
            <div class="actions">
                <a class="btn btn-circle btn-icon-only btn-default tooltips" href="<@BackURL/>" title="<@spring.message code="button.back.tips"/>">
                    <i class="icon-action-undo"></i>
                </a>
            </div>
        </div>
        <div class="portlet-body">
            <div class="row">
                <div class="col-md-12">
                    <div class="panel panel-info">
                        <div class="panel-heading">
                            <h3 class="panel-title">
                                <span class="bold"><@dateTime date=m.sendDate /></span>
                                <@messageFromToDesc message=m currentUser=user/>
                            </h3>
                        </div>
                        <div class="panel-body"> 
                            <div class="panel-group accordion" id="accordion">
                                <!-- before -->
                                <#list messages as message>
                                    <#if message.sendDate lt m.sendDate>
                                        <@messageView message=message/>
                                    </#if>
                                </#list>
                            
                                <@messageView message=m collapse="in"/>
                                
                                <!-- after -->
                                <#list messages as message>
                                    <#if message.sendDate gt m.sendDate>
                                    <@messageView message=message/>
                                    </#if>
                                </#list>
                                
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <br/>
        </div>
    </div>
</div>

<page-plugin-style>
</page-plugin-style>
<page-plugin-script>
</page-plugin-script>
<page-style></page-style>
<page-script>
	<script>
		jQuery(document).ready(function() {
			$(".btn-view-store").click(function() {
                var href = $(this).data("href");
                $.m.confirm({
                    title: '<@spring.message code="op.save.store"/>',
                    message: '<@spring.message code="sure.prefix"/><@spring.message code="op.save.store"/><@spring.message code="question.suffix"/>',
                    ok: function () {
                        location.href = href;
                    }
                });
                return false;
            });
    
            $(".btn-view-recycle").click(function() {
                var href = $(this).data("href");
                $.m.confirm({
                    title: '<@spring.message code="op.move.trash"/>',
                    message: '<@spring.message code="sure.prefix"/><@spring.message code="op.move.trash"/><@spring.message code="question.suffix"/>',
                    ok: function () {
                        location.href = href;
                    }
                });
                return false;
            });
    
            $(".btn-view-delete").click(function() {
                var href = $(this).data("href");
                $.m.confirm({
                    title: '<@spring.message code="op.delete.trash"/>',
                    message: '<@spring.message code="sure.prefix"/><@spring.message code="op.delete.trash"/><@spring.message code="question.suffix"/>',
                    ok: function () {
                        location.href = href;
                    }
                });
                return false;
            });
			
		});
	</script>
</page-script>